#!/bin/bash
bin_file="fw_payload.bin"
if [ -f "$bin_file" ]; then  
    echo "删除文件 $bin_file"  
    rm "$bin_file"  
fi
export CROSS_COMPILE="/opt/riscv/bin/riscv64-unknown-elf-" 
cd opensbi 
make clean 
make distclean 
make PLATFORM=generic FW_PAYLOAD_PATH=../Build/VisionFive2/DEBUG_GCC5/FV/VISIONFIVE2.fd FW_FDT_PATH=../Build/VisionFive2/DEBUG_GCC5/RISCV64/Platform/StarFive/VisionFive2/DeviceTree/VisionFive2DeviceTree/OUTPUT/StarFiveVisionFive2.dtb FW_TEXT_START=0x40000000 
cp ./build/platform/generic/firmware/fw_payload.bin ../
cd .. 
echo "opensbi编译完成   生成$bin_file"
